Computing.Net > Forums > Web Development > java script pop up

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

java script pop up

Reply to Message Icon

Name: BigShow
Date: July 24, 2005 at 18:34:52 Pacific
OS: xp
CPU/Ram: amd athlon 700mhz,256 k
Comment:

Hey guys I need to get a javascript that wil make it so when someone clicks on a link on my webpage a window with the corresponding information pops up in front, they can read it then X out of it. I thought I found a good script but I cannot get it to work. I need this for 2 different links on the same page....here is what I got so far...

{head}


[script language="JavaScript"]
[!-- Hide from old browsers

function winopen(){
window.open('cdl.html', 'NewWindow1',

'toolbar=yes,location=yes,directories=no,

status=no,menubar=yes,scrollbars=yes,resizable=no,copyhistory=yes,

width=635,height=260')


window.open('labor.html', 'NewWindow2',

'toolbar=yes,location=yes,directories=no,

status=no,menubar=yes,scrollbars=yes,resizable=no,copyhistory=yes,

width=635,height=260')
}
// -->
[/script]
{head}
{body}

CDL Drivers
Laborers

{/body}

basically if someone clicks on the cdl link a window pops up describing the job and the same with the laborer...any help would be appreciated.



Sponsored Link
Ads by Google

Response Number 1
Name: Michael J (by mjdamato)
Date: July 24, 2005 at 18:59:22 Pacific
Reply:

The problem is that you are referencing a href value in your anchor tag (i.e. A tag).

Your link should be something like this:

CDL Drivers

Note, you should add the "return false" to the onclick value to prevent the main page from refreshing - which would make the page scroll to the top.


0

Response Number 2
Name: Michael J (by mjdamato)
Date: July 24, 2005 at 19:01:01 Pacific
Reply:

Let's try again replacing the < & > with brackets:

[a href="#" ONCLICK="winopen();return false;"]CDL Drivers[/a]


0

Response Number 3
Name: BigShow
Date: July 24, 2005 at 19:21:20 Pacific
Reply:

Michael, I did the return false cose which was actually going to be my next question but now I need to know how to get this to work, I click the link and nothing at all happens...any ideas.


0

Response Number 4
Name: randy1959
Date: July 24, 2005 at 20:38:19 Pacific
Reply:

See if this works for you. Just change the [&] brackets to < & >, change the webpage name parts to your webpage, and make changes to the window elements you want to show or hide or resize.


[a onClick="MyWindow=window.open('WebPageName.htm','MyWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=800,height=600,left=1,top=1'); return false;" href="WebPageName.htm"]
Link Text[/a]



0

Response Number 5
Name: Michael J (by mjdamato)
Date: July 25, 2005 at 06:37:44 Pacific
Reply:

You must have a typo somewhere, it works for me. Try this code - use find/replace to change the [] to <>.

[html]

[head]
[script language="JavaScript"]
function winopen(){
window.open('cdl.html', 'NewWindow1', 'toolbar=yes,location=yes,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=no,copyhistory=yes,width=635,height=260');
window.open('labor.html', 'NewWindow2', 'toolbar=yes,location=yes,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=no,copyhistory=yes,width=635,height=260');
}
[/script]
[/head]

[body]
[a href="#" ONCLICK="winopen();return false;"]CDL Drivers[/a]
[/body]

[/html]

Michael J


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: java script pop up

Pop-Up Windows Script www.computing.net/answers/webdevel/popup-windows-script/1257.html

Java Script not working on web site www.computing.net/answers/webdevel/java-script-not-working-on-web-site/1693.html

Pop Up Window www.computing.net/answers/webdevel/pop-up-window/2254.html