Jump to content


Photo
- - - - -

Confused with some javascript


  • Please log in to reply
2 replies to this topic

#1 TecKchriS

TecKchriS

    oxymoronman

  • ++Member
  • 118 posts
  • Gender:Male

  • United States

Posted 04 April 2008 - 12:10 AM

Hello everyone,

I am somewhat new to web development. I'm decent at being able to create websites with sql databases and so on, but not so much of the front end with the javascript.

I have code from http://www.jtricks.c...window/box.html that enables me to have a pop-up within my page, displaying it is not the problem, its trying to close the pop-up that is stumping me and others who tried to help me.

I am using this as a box for logging in and adding comments and so on. I first need to run some php to add their information to their session and then I want to automatically close the pop-up and refresh the page they are on. So I have tried everything from javascript alerts that use
CODE
java script:void(0);
or the function that they specify to use as a onclick
CODE
return show_hide_box(this, 200, 270, '2px solid')
or even
CODE
window.close()


I have used these with form onclick= , echo "<script>...</script>" but it only seems to work when you wrap it in an anchor for a link.

Is there a reason that anyone sees that I am messing up, or is just the code made that it can not be closed unless clicked on a link?




#2 amir

amir

    SuperNova III Member

  • Support Team
  • 2,141 posts
  • Location:Toronto
  • Interests:http://adagio.fm<br />http://entranced.fm/

  • Canada

Posted 05 April 2008 - 02:27 PM

it's using the HREF value of the link to look for the popup. you should change the show_hide function to this:

# function show_hide_box(popupID, width, height, borderStyle)
# {
# var boxdiv = document.getElementById(popupID);
#
# if (boxdiv != null)
# {

this could break other parts but checking the firefox error console will give you a clue. post back with the results if you want.


#3 TecKchriS

TecKchriS

    oxymoronman

  • ++Member
  • 118 posts
  • Gender:Male

  • United States

Posted 06 April 2008 - 08:22 AM

Thanks for the suggestion, it was actually able to do what I was looking for, had to modify it a bit to get everything in place, but me and a friend we able to patch it enough that it worked for us. Thanks for the help!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users