Setting binary to src does not constitute as invoking the binary function

Below is the code that is executed behind the scenes:

Dim test1 As HtmlGenericControl = CType(e.Item.FindControl("test1"), HtmlGenericControl)
        Dim image As HtmlGenericControl = CType(e.Item.FindControl("imgFullImage"), HtmlGenericControl)
        hypImageProduct.Attributes.Add("onMouseOver",
                                       "ShowContent('" + test1.ClientID + "');document.getelementbyid('" + image.ClientID + "').src ='binary('" + Convert.ToBase64String(New DataClass().getProductStockPhoto(image.Attributes("alt"), 40, 40)) + "')';")

Next, here is the function used on the page for decoding binary data, but it seems like it's not being called:

function binary(d) {
        var o = '';
        for (var i=0; i<d.length; i=i+2) o+=String.fromCharCode(eval('0x'+(d.substring(i,i+2)).toString(16)));
        return o;
    }

I might be missing something obvious, but I expected it to work correctly.

Answer №1

There are additional apostrophes surrounding the function call. Modify it as follows:

... +"').src = binary('" + ... + "');")

instead of:

... +"').src ='binary('" + ... + "')';")

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to extract the singular PDF link from a webpage?

Currently, I am attempting to utilize Selenium in Java to access DOM elements. However, I have encountered an issue while testing the code: Exception in thread "main" org.openqa.selenium.StaleElementReferenceException: stale element reference: element is n ...

The left margin in Carousel is malfunctioning when it comes to hovering

I would like to achieve an effect where, on hover, my images shift the other images to both the left and right. However, currently when hovered, all the images shift to the right only. The code snippet in question is as follows: .item-img:hover { trans ...

Is there a way to keep my fixed button at a consistent size while zooming on mobile devices?

There are no definitive answers to the questions regarding this issue. Some suggest stopping zoom altogether, while others recommend setting the width, which may not always solve the problem. I am working on a web application designed for mobile use with ...

Is it possible to update labels on an AngularJS slider using a timeout function?

I recently started implementing an AngularJS slider to navigate through various date and time points. Specifically, I am utilizing the draggable range feature demonstrated in this example - https://jsfiddle.net/ValentinH/954eve2L/ The backend provides the ...

Dealing with errors when making HTTP requests in AngularJS using the `then`

What is the best way to tackle an HTTP error like 500 when utilizing AngularJS "http get then" construct (promises)? $http.get(url).then( function(response) { console.log('get',response) } ) The issue here is that for any non-20 ...

The system was unable to identify the string as a valid DateTime format during the conversion process

Issue I am encountering difficulties in converting a String to a DateTime format and then back to a String. Situation # 1 string time = "20120718 00:56:03"; DateTime theTime =DateTime.ParseExact(time,"MM-dd-yyyy HH:mm:ss",CultureInfo.InvariantCulture,Da ...

Improving the efficacy of Linq-to-SQL queries

I am in search of a more streamlined approach for this task...(see below)... I need to repeat it seven times because there are seven feature articles. The identifier I'm using is the page id (also known as featurearticles.fk_pageID_item1 featurearticl ...

Sending files asynchronously using Angular and ng-file-upload through a RESTful API

I have a form with multiple file upload fields. Here is the process: User fills out the form User selects the files to upload User clicks submit Now, here is what I would like to achieve: Submit the form to the server and receive an ID in return Uploa ...

Tips for customizing the appearance of the tooltip in echart using Angular

Need help with echart tooltip formatting. If you'd like to take a look at the code, click here: https://stackblitz.com/edit/angular-ngx-echarts-ty4mlq?file=src/app/app.component.ts const xAxisData = []; const data1 = []; const data2 = []; const data ...

Is there a method to easily determine the final character within a textbox's text content?

As a novice in C#, I am currently working on building a web calculator similar to the Microsoft Desktop calculator using asp.net. However, I have encountered a roadblock in my progress. The code snippet for performing operations such as addition, subtracti ...

Unable to ascertain property 'match' of undefined in asp.net MVC Morris Chart

Greetings! I am currently in the process of building a dashboard that includes a Morris chart. The dashboard is built using ASP MVC. Using JavaScript, I invoke a function in my controller to retrieve data. $.get('@Url.Action("Diagram")', funct ...

Customize the appearance of the v-autocomplete component in Vuetify

How can I style the autocomplete component to only show words that begin with the letters I'm typing, rather than all words containing those letters? Also, is there a way to display the typed letters in bold without highlighting them? https://i.sstat ...

Refreshing MVC5 Partial View with Embedded Document Viewer

In my MVC5 partial view, there is a document viewer and an upload button for users to add documents. I need to refresh the partial view or reload it completely after a document is uploaded so that the newly uploaded document is immediately visible. Below ...

The error message received states that the `map` operator in RxJs pipe and the lettable operator cannot assign a 'void' context to a method with an 'Observable<{}>' context

This is a simple example that demonstrates the use of the lettable operator map with pipe from the provided link: import { map } from 'rxjs/operator/map'; let o = of(1, 2, 3, 4).pipe( map((v) => v * 2) ); However, when running this code ...

Checking for collisions among numerous elements in JS: An insightful guide

I have created 40 images with random positions, however, some of them collide in certain cases. My question is how to prevent collisions and assign new positions if they do occur? Below is my code along with comments for clarity. $( document ).ready(fun ...

using the image source in the onclick function

I have implemented the following code to convert an image to grayscale using Javascript. <body> <canvas id="myCanvas" width="578" height="400"></canvas> <script> function drawImage(imageObj) { var canvas = document.getElement ...

Embed a stackoverflow.com iframe within a jsbin

While exploring code using jsbin, I mistakenly linked the iframe to . When my work in loads, it triggers an alert that redirects back to . I am unable to figure out how to modify my jsbin code. Is there a solution or should I start from scratch? ...

Exploring Ramda JS for mapping a particular value from two JSON files

One challenge I'm facing involves using 2 JSON files to map out the status of an event, and I'm unsure how to execute this in Ramda. const input1 = { data: { memberId: 12345, orderStatus: pack ...

Is there a way to use setTimeout in JavaScript to temporarily stop a map or loop over an array?

data.forEach((d, i) => { setTimeout(() => { drawCanvas(canvasRef, d); }, 1000 * i); }); I have implemented a loop on an array using forEach with a one-second delay. Now I am looking to incorporate a pause and resume f ...