All i would like to do is insert an image next to the question. Im sure this is a very easy thing to do. I just cant seem to do it.
any help would be great, thank you

    '<input type="hidden" name="questions[' + n + '][number]" value="' + n + '" />' +
                '<b><u><p>question :' + (n+1) + '</p></u</b><input type="text" name="questions[' + n + '][name]" />' +     
                      '<input type="hidden" name="questions[' + n + '][running]" value="Y" />' + 

Recommended Answers

All 4 Replies

Where will execute your code?

I think we need more of your code to get a better picture of what you are trying to do.

Thanks for the reply, here is the whole js file.
I would like to add an image next to the question.
uploads/1image.png is the location of the image file.

function scoreboard_general()
{
    // handler for our custom form buttons
    $('form span.button.submit').click(function(){
        $(this).parents('form').submit()
    })

}

function scoreboard_mark()
{
    // handler for table row & correct answer highlights
    $('table#entries tbody tr')
        // table row hover: on
        .mouseover(function(){
            $(this).addClass('over')
        })
        // table row hover: off
        .mouseout(function(){
            $(this).removeClass('over')
        })
        // table row select: highlight and show tick
        .click(function(){
            if( $(this).is('.selected') ) {
                // deselect row
                $(this)
                    .removeClass('selected')
                    .find('input[name*="[correct]"]').val('N')
            }
            else {
                // select row
                $(this)
                    .addClass('selected')
                    .find('input[name*="[correct]"]').val('Y')
            }
        })

    // handler for 'select all'
    $('span.button#select-all').click(function(){
        $('table#entries tbody tr')
            .addClass('selected')
            .find('input[name*="[correct]"]').val('Y')
    })

    // handler for 'select none'
    $('span.button#select-none').click(function(){
        $('table#entries tbody tr')
            .removeClass('selected')
            .find('input[name*="[correct]"]').val('N')
    })

    // handler for matching string
    $('form#controls').submit(function(){
        var keyword = $(this).find('input#quickmark-text').val().toLowerCase()
        if ( keyword.length > 0 )
        {
            $('table#entries tbody tr:has(td.answer)').each(function(){
                var td = $(this).find('td.answer').text().toLowerCase()
                if ( td.indexOf(keyword) != -1 )
                    $(this)
                        .addClass('selected')
                        .find('input[name*="[correct]"]').val('Y')
            })
        }
        return false
    })



}

function scoreboard_login()
{
    $('fieldset#login input#password').focus()
}

function scoreboard_setup()
{
    $('form#question-setup fieldset:last input[type="text"]').focus()

    // handler for adding/removing questions
    $('#question-add').click(function(){
        var n = $('form#question-setup fieldset').size()


        // new question fieldset

        $('form#question-setup fieldset:last')
            .after('<fieldset style="display:none;"><legend>Question ' + (n+1) + '</legend>' +



                '<input type="hidden" name="questions[' + n + '][number]" value="' + n + '" />' +
                '<b><u><p>Question :' + (n+1) + '</p></u</b><input type="text" name="questions[' + n + '][name]" />' +     
                      '<input type="hidden" name="questions[' + n + '][running]" value="Y" />' +                     




'<div class="question-remove" title="Remove this Questiont"></div>' +
                '</fieldset>')

        // get newly added fieldset
        var form = $('form#question-setup')
        var fieldset = form.find('fieldset:last')

        // animates new fieldset
        fieldset.slideDown(200, function(){
            // focus new question field
            fieldset.find('input[type="text"]').focus()
        })


        // handler for removing this question fieldset
        fieldset.find('div.question-remove').click(function(){
            // hide the fieldset
            $(this).parents('fieldset').slideUp(200, function(){
                // remove the fieldset
                $(this).remove()
                // renumber the remaining fieldsets
                form.find('fieldset').each(function(i){
                    $(this).find('legend').text('Question ' + (i+1))
                    $(this).find('input[name$="[number]"]')
                        .attr('name', 'questions[' + i + '][number]')
                        .attr('value', i)
                    $(this).find('input[name$="[name]"]')
                        .attr('name', 'questions[' + i + '][name]')
                    $(this).find('input[name$="[running]"]')
                        .attr('name', 'questions[' + i + '][running]')
                        $(this).find('input[name$="[number]"]')
                        .attr('name', 'Question1[' + i + '][number]')
                        .attr('value', i)
                    $(this).find('input[name$="[name]"]')
                        .attr('name', 'Question1[' + i + '][name]')
                    $(this).find('input[name$="[running]"]')
                        .attr('name', 'Question1[' + i + '][running]')                      
                })
            })
        })
    })

}

Any thoughts ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.