Kristian_C Posted December 28, 2006 Share Posted December 28, 2006 Anyone here that knows how to add a image to a alert box? If it is possible at all?->Kristian_C Link to comment Share on other sites More sharing options...
PrateekSaxena Posted December 28, 2006 Share Posted December 28, 2006 I am not a total expert in JavaScript but I dont thinkg that this is actually possible to add a custom image to an alert box. But if you really want an image in the alert you can make your own function that would be able to pop up any time. Try this out. <html><head><script>function loadIt(){ pop.style.display="none";}function popIt(what){ pop.innerHTML="<img src='http://geocities.com/psaxena_17/197.jpg'/><p>"+what+"</p>"; pop.style.display= " ";}function close(){ pop.style.display="none";}</script><style>#pop{ position:absolutel top:100px; left:100px;}</style></head><body><a href="#" onClick="popIt('Testing the pop function')">test it</a><div id="pop"></div></body></html> I have not comiled the code myself so please correct any minor errors Link to comment Share on other sites More sharing options...
Kristian_C Posted December 28, 2006 Author Share Posted December 28, 2006 I am not a total expert in JavaScript but I dont thinkg that this is actually possible to add a custom image to an alert box. But if you really want an image in the alert you can make your own function that would be able to pop up any time. Try this out.<html><head><script>function loadIt(){ pop.style.display="none";}function popIt(what){ pop.innerHTML="<img src='http://geocities.com/psaxena_17/197.jpg'/><p>"+what+"</p>"; pop.style.display= " ";}function close(){ pop.style.display="none";}</script><style>#pop{ position:absolutel top:100px; left:100px;}</style></head><body><a href="#" onClick="popIt('Testing the pop function')">test it</a><div id="pop"></div></body></html> I have not comiled the code myself so please correct any minor errors Hmm, it works tho. but i cant have any links or anything, and it should just popup from the screen when the user gets like a message to the inbox etc.. but trying to make something else to so thats why i need picture hehe...But thanks for the help to, i really cant do anything with javascript so allways good to get some help..-> Kristian_C Link to comment Share on other sites More sharing options...
PrateekSaxena Posted December 28, 2006 Share Posted December 28, 2006 So wherever you have written alert("you got a new message dude") just replace that code with popIt("you got a new message dued") and add the neccessary JS/XHTML/CSS Link to comment Share on other sites More sharing options...
Kristian_C Posted December 28, 2006 Author Share Posted December 28, 2006 That part aint hard. Its only the image i cant figure out.. If you know how to create a simple popup window? like a normal browser window.. goes like : <?if($bruker->meld=ny){echo"Then the function thig to aktivate the popup should go here or something :p hehe... dont know if its possible at all...";->Kristian_C?> Link to comment Share on other sites More sharing options...
PrateekSaxena Posted December 28, 2006 Share Posted December 28, 2006 I dont know PHP Link to comment Share on other sites More sharing options...
Kristian_C Posted December 28, 2006 Author Share Posted December 28, 2006 I dont know PHP The php part can i figure out myself.. just need help to create the popup thing.. etc a code so when u go on a page another window pops up. The part with when the window should come and stuff wont be a problem..-> Kristian_C Link to comment Share on other sites More sharing options...
PrateekSaxena Posted December 28, 2006 Share Posted December 28, 2006 make it - <body onload='popIt("Is this ok?")'></body> I am not sure what you are looking for Link to comment Share on other sites More sharing options...
Kristian_C Posted December 28, 2006 Author Share Posted December 28, 2006 Just a create window function hehe... ¨just like you click a link and the window opens in a browser... but i want to have the control the window myself.. so if the user gets a new message a new window pops up... But thanks for the help anyway tho Link to comment Share on other sites More sharing options...
jesh Posted December 28, 2006 Share Posted December 28, 2006 Like Prateek said in the beginning, it's not possible to add an image to an alert, confirm, or prompt box. You'll have to either use a div and position it so that it appears to be above the rest of your content (like Prateek suggested) or you'll have to open up a new browser window to display your message.There are a number of window.open scripts available. One of them is here:http://w3schools.invisionzone.com/index.php?showtopic=9500 Link to comment Share on other sites More sharing options...
PrateekSaxena Posted December 29, 2006 Share Posted December 29, 2006 I still dont understand what he exaclty wants...an alert box or a popUp window Link to comment Share on other sites More sharing options...
Kristian_C Posted January 2, 2007 Author Share Posted January 2, 2007 Hehe, dont need anything now just needed something that came up with a image. etc a popup window. But i just gave up the idea Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now