Hi

I am going to new page from current page on click of a button using function :

function gotonextpage()
{
window.location.href = "newurl";
}

I also want to call another function on load of new page to set its paragraphs. I am hiding or showing paragraphs based on a dropdown value selected in first page.

I dont want to do <body onload="func()"> in my second page. Is there any other alternative to this? Also, I have all my js code in separate file.

Thanks,
VC

Recommended Answers

Have you tried embedding the onload function in the gotonextpage() function?

Jump to Post

All 4 Replies

Have you tried embedding the onload function in the gotonextpage() function?

Try this

function gotonextpage()
{
    window.location.href = "newurl";

    window.onload = function()
    {
       paragraph code setting here
    }
}

I tried it. Its not working.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.