SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Threaded View

  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2009
    0 Post(s)
    0 Thread(s)

    Question Border Not Changing Colour On Click

    I'm having problem understanding Javascript's behavior with this excerise below.

    Hoping someone can help me.

    I'm not getting the borders of the images I click on to turn yellow right away.....I'll explain.

    Please, following along with the pictures attached to this posting; they'll help you understand my problem.

    Essentially, while holding down the Ctrl-key, I am selecting mutiple images at time and 'processing' them.

    Visually, I want to user to see this by, with every click of the mouse while holding down teh Ctrl-key, the borders of selected image turns a golden yellow. (see images: BeginClicking.JPG & NowClicked.JPG)

    In the attachments, you'll see that I'm starting in the top right-hand corner and clicking on a total of five images down to the lower left-hand corner when all is said and done.

    Viewed in the order BeginClicking.JPG, NowClicked.JPG and then ManyClicked.JPG., the border's of the selected images are turning yellow.

    The trouble is they're not.

    With some 'paint brush magic', you're see how it *should* work, but the borders don't actually turn yellow until I 'submit' the form???

    Below is an extreme abbreviation of the code involved:

    <img onclick="_OnEntryDo(window.document.AEntryForm, this);" ....... />

    function _OnEntryDo(form, obj) {

    if ( window.event.ctrlKey ){['border-color'] = '#CCCC33'; <--- Set the img object's border to that color.

    function _TimeToSubmit(form, obj) {

    form.submit(); <--- Submitting the form within JavaScript.

    It is only when I submit the form within JavaScript that you will see the selected images suddenly hightlight with a yellow border.

    So, from the user's point of view, she'll see all the images as seen in BeginClicking.JPG as she's clicking on the ones she wants, but in a flash, will see them as in ManyClicked.JPG when she finally submits the form.

    Of course, that is only for a moment, as the form is now submitted and the 'selected' images will now be processed.

    My problem is that I want the selected images to be highlighted right away in real time while the user is selecting them and not until the form is finally submitted.

    What gives?


    Attached Images Attached Images


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts