Kanda's Memos: Javascript - What I have learned (1)



1. First of all it is about the annoying pop-ups. (LOL!)

Script in the head section:
<head>
<script type="text/javascript">
<!--
alert('Hello! There will be five annoying pop up boxes. (:< ' Hehehe... );
alert('Hello again!!!');
alert('Did I say hello?!');
alert('I guess I did\, LOL! OK... One more. Just one!');
alert('Isn\'t this annoying?! I promise you this is the last one.');
//-->
</script>
</head>


Notes:
•     \ ( Back slash)     is to "hide the single quotation marks or commas in the sentence from js execution"
       In other words, so that the quotation marks or commas immediately after it will be just text.
•     <!--     is to make sure older browsers don't display the script as text.
•     //-->     is to unhide.

•     The alert boxes CAN be customized but it is not easy. See this:

Custom Alert Demonstration   http://slayeroffice.com/code/custom_alert/)

I have come across a clever popup customizing software. I do not think it is free:

http://www.codebelly.com/index_popmaker.html

Isn't it interesting?!


2. Button is less surprising.
No need for SCRIPT tag.



Script:
<FORM action="submit">
<INPUT type="button"value="Click here!" onClick="alert('Wow\, you clicked!')">
</FORM>


Note: No space is allowed inside the INPUT tag except inside the ('____ ')

I have seen background changing scripts but it is too complicated for me at this stage to have a pop-up and a change of background color at the same time. Maybe later.

3. If you click anywhere inside this paragraph you will see an alert.
Paragraph
paragraph
paragraph.

Script:
<p style="padding:1px; border:1px solid #5681ac; margin-right:600px; padding-left:20px; text-indent:-15px;" onClick="window.alert('What\'s up?');">
[The Paragraph above.]
</p>


Note: the part in bold must be kept in one line without space in between except some single white space in the text inside this: ('_____').

4. onMouseover

Point at me, point at me!

Script:
<a href="noplace" onMouseover="alert('This is the effect of onMouseover.')"> Point at me, point at me!</a>



To be continued....

Back to Kanda's Blog

Back to Kanda's Homepage