Jump to content

shaffiq_fiq88

Members
  • Posts

    37
  • Joined

  • Last visited

Posts posted by shaffiq_fiq88

  1. <!doctype html><html><head><meta charset="utf-8"><title>Untitled Document</title><style type="text/css">.sectionseparator {	background-image:url(/asset/image/accordion_icon_sprite.png);	background-position:0px 0px;}.sectionseparator:hover {	background-image:url(/asset/image/accordion_icon_sprite.png);	background-position:0px 101px;}.sectionseparator.open {	background-image:url(/asset/image/accordion_icon_sprite.png);	background-position:0px 27px;}.sectionseparator.open:hover {	background-image:url(/asset/image/accordion_icon_sprite.png);	background-position:0px 64px;}</style><script language="javascript" type="text/javascript">function imgHover(o){        //what script shoud I put here??};function showHideInfo(o){        //Don't worry about this. Already done.};</script></head><body><a id="section-spg" href="#" onClick="showHideInfo(this);" onMouseOver="imgHover(this);"><img id="section-spg-img" src="/asset/image/invis.gif" width="27" height="27" class="sectionseparator" style=" position:absolute;margin-top:5px;"> <div style="display:inline-block; position: relative; top:6px; left:35px;">SPG</div></a><div id="spg-info">SPG Info</div></body></html>

    I want background image of 'section-spg-img' changed as 'sectionseparator:hover' when I hover mouse in any region within 'section-spg'. I've searching and try every event method. Either I'm stupid enough and failed or I'm not understand anything about event.

     

    Image sprite contain {+,hovered +, -, hovered -}.

    showHideInfo() change either + or - of the image and show or hide 'spg-info'. (success)

    imgHover() change either hovered + or hovered - of the image. (failed)

     

    Example : http://www.microsoft.com/en-us/download/details.aspx?id=30653 (Detail, System Requirement, etc...)

     

    I don't wanna use jQuery.

    Thank you.

  2. I want to capture keypress event while passing other value in function. I've already and still googling but still not found the answer.Here is the coding :

    function inputkeyup(i){if (event.keyCode!==13){// do something like thisalert(i.value)};};<input name="myipt" type="text" id="myipt" size="15" maxlength="12" onKeyUp="inputkeyup(this)"><input name="myipt2" type="text" id="myipt2" size="15" maxlength="12" onKeyUp="inputkeyup(this)">

    Latest Firefox console tell "ReferenceError: event is not defined" and the code is not functioning :(

    How to make it working? :crazy:

    No jQuery please because I will learn nothing.

     

    Thanks for any help.

  3. function keyE(e,n,v) {// some function here}; function editProp(n) {// the caller is a button with function onClick="editProp('userID')"// n = 'userID'var dStr = document.getElementById(n).innerHTML;document.getElementById('f_' + n).innerHTML = '<input type="text" name="i_' + n + '" id="i_userID" value="' + dStr+ '" onkeypress="keyE(event,' + n + ',this.value)" />'; //error heredocument.getElementById('i_' + n).focus();document.getElementById('i_' + n).setSelectionRange(0,dStr.length);} // debug with Mozilla Firefox 15.0.1 Developer Tools

    The editProp(n) function generate error and I don't know how to fix it. The error is at document.getElementById('f_' + n).innerHTML = '<input type="text" name="i_' + n + '" id="i_userID" value="' + dStr+ '" onkeypress="keyE(event,' + n + ',this.value)" />'; The phrase onkeypress="keyE(event,' + n + ',this.value)" generate error "userID is not defined". userID is a string defined in n variable but it detect it as a variable. How to fix it? Thanks for any help provided. errjava.png?psid=1

×
×
  • Create New...