Random Notes on JavaScript/HTML #13

This short-note will make sense, only if you already have some javascript sense. It can be used – just to refresh memory, once in a while. My JavaScript Experience? started on 2000, conducted a JavaScript Training Session on 2001, wrote a book for a training institute on JavaScript on 2001, using javascript always from that time – for this and that (personal and/or commercial, at home/work). Am I an expert? That’s an interesting question – “I am an expert” is a ridiculous statement to me (also in my culture to some extent), However, I can say – whatever I wanted to do or I was required to do in JavaScript – I could do – without much/any trouble, and without hanging in the forums for weeks waiting for someone else to reply to my silly questions. I also believe, whatever I will require to do in JavaScript, I will be able to do without any/much trouble.

  1. How to embed applet in javascript code:
    
    

    Parameter values are passed to the applet

  2. Possible attributes of applet tag: code, archive, name, height, width, mayscript
  3. Custom applet parameters are sent by using param tag
  4. You can use JSObject to pass information from Applet to javascript
    Java Side:JSObject jso = JSObject.getWindow(this);jso.eval("slider(" + jCSlider1.getValue() + ")");JavaScript Side:function slider(theSetting) {document.theForm.txtSetting.value = theSetting;}
  5. Linking to shockwave files:
    http://value1.dcr
  6. Linking to activex objects/controls:
    ActiveXcontrol.property="value";

    ActiveXcontrol.property=”value”; is to access activex objects’ properties

  7. Communicating with Java Server Pages:
    
    
  8. Difference Between CSS visibility and display Attributes: When visibility is false, the area is replaced with white spaces. When display attribute is false, the block is completely removed [no white space occulies the area]
  9. Within javascript, you can also use CSS properties. The syntax: document.elementname.style.propertyname
    Example:document.element1.style.visibility = 'hidden';
  10. Javascrip and CSS property mapping:
    CSS Property JavaScript Reference
    background background
    background-color backgroundColor
    background-image backgroundImage
    border border
    border-color borderColor
    border-style borderStyle
    color color
    display display
    font font
    font-family fontFamily
    font-size fontSize
    margin margin
    margin-bottom marginBottom
    margin-left marginLeft
    margin-right marginRight
    margin-top marginTop
    vertical-align verticalAlign
    visibility visibility
  11. Change element appearance dynamically:
    document.getElementById(“element id”).style.visibility = “property”;
  12. Change the background color of an element:
    document.getElementById(“element id”).style.background = color;
  13. Element content manipulation:

    sometext

    document.getElementById("para1").innerText = "newtext";document.getElementById("para1").innerText = "newtext";document.getElementById("para1").innerHTML = "newtext";
  14. Validating Forms in JavaScript using Custom objects: I think, an example will make sense
       &ltSCRIPT language="JavaScript"> var frmvalidator  = new Validator("myform"); frmvalidator.addValidation("FirstName","alpha");  frmvalidator.addValidation("FirstName","alpha"); frmvalidator.addValidation("FirstName","req","Please enter your First Name"); frmvalidator.addValidation("FirstName","maxlen=20","Max length for FirstName is 20");
  15. Create temporary cookie:
    document.cookie = "myCookie=gingerbread";cookieValue = escape("A B, C D");document.cookie = "myCookie=" + cookieValue;expDate = "Wed, 3 Mar 2000 14:41:00 UTC";document.cookie = "myCookie=sugardrop;" + "expires=" + expDate;
  16. To access all cookies in a loop: Get the cookie using var cookieString = document.cookie;, then split the cookiestring using split function at “;” like var cookieArray = cookiestring.split(“;”); Then you can use a loop to traverse the array and retrieve cookie name and value
  17. Deleting cookies:
    function del_cookie(name) {  document.cookie = name + '=; expires=Thu, 01-Jan-70 00:00:01 GMT;';} 
  18. Javascript Array Examples:
    thisArray = new Array();thisArray.Contents = "Alphabet";thisArray[0] = "A";thisArray[1] = "B";thisArray[2] = "C";-----garden["North Patch"] = "vegetables";garden["South Patch"] = "herbs";garden["West Border"] = "perennial flowers";-------processors = new Array("AMD","Intel","Cyrix","Motorola");
  19. Delete an array element:
    delete anArray[2]; it does not change the length of the array but anArray[2] will have no value and undefined
  20. Destroy an array:anArray.length = 0;anArray = null;
  21. Other Javascript articles What you really need to learn in Javascript?

    How to implement multiple tab webpages in Ajax and Javascript

    Handling Checkbox arrays with Javascript::GetElementsByName:XHTML supported

    Javascript by Example

    Javascript – Form validation

    JavaScript – Miscellaneous Validations

    Javascript Codes

    JavaScript Frameworks

    GWT: Google Web Toolkit

    JavaScript: Pass by Value: Pass by Reference

    Random Notes on JavaScript/HTML

    Random Notes on JavaScript/HTML

    JQuery

    Introduction to JQuery

    JavaScript DOM: Must knowledge to understand Ajax

    Ajax: An Overview

From: http://sitestree.com/?p=5208
Categories:13
Tags:
Post Data:2009-03-19 21:26:36

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>